package com.metaera.app.ui.activities;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.metaera.app.R;
import com.metaera.app.controller.core.IPaginationPresenter;
import com.metaera.app.controller.core.SimplePaginationPresenter;
import com.metaera.app.controller.view.core.IPaginationView;
import com.metaera.app.data.DataRepository;
import com.metaera.app.data.model.BasicListResponse;
import com.metaera.app.data.model.CollectionListResponse;
import com.metaera.app.data.network.ApiParam;
import com.metaera.app.ui.adapters.CollectionAdapter;
import com.metaera.app.ui.core.BaseRequestListActivity;

import androidx.recyclerview.widget.RecyclerView;
import io.reactivex.Observable;

/**
 * 收藏列表
 */
public class CollectionListActivity extends BaseRequestListActivity<CollectionListResponse> {


    @Override
    protected String getActivityTitle() {
        return getString(R.string.my_collections);
    }

    @Override
    protected BaseQuickAdapter<CollectionListResponse, BaseViewHolder> createAdapter(RecyclerView recyclerView) {
        return new CollectionAdapter();
    }

    @Override
    protected IPaginationPresenter<IPaginationView<CollectionListResponse>, CollectionListResponse> createPresenter() {
        return new SimplePaginationPresenter<CollectionListResponse>() {
            @Override
            protected Observable<BasicListResponse<CollectionListResponse>> execute() {
                return DataRepository.getInstance().myCollection(mPage, ApiParam.PAGE_SIZE);
            }
        };
    }

}
